package com.joke.auto;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.joke.util.DateUtil;

public class JokeFetchQuartz {

	// 日志输出
	private static final Logger logger = LoggerFactory.getLogger(JokeFetchQuartz.class);

	JokeFetch jokeFetch = new JokeFetch();
	
	// 定时任务执行 
	public String fetch(){
		logger.info("---"+DateUtil.formatString(new Date(), DateUtil.YMD)+"进入定时任务---");
		String flag = "Success";
		try {
			flag = jokeFetch.fetch();
		} catch (Exception e) {
			flag = e.getMessage();
			return flag;
		}finally{			
			logger.info("---"+DateUtil.formatString(new Date(), DateUtil.YMD)+"退出定时任务---");
		}
		return flag;
	}
	
	public static void main(String[] args) {
		new JokeFetchQuartz().fetch();
	}

}
